﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RestaurateurConsole
{
    class XActionHandler
    {
        SerializationHandler serializer = new SerializationHandler(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Restaurateur", "RestaurateurMenu.balance");
        XActionList list = null;

        public XActionList List 
        { 
            get 
            {
                if (list == null)
                {
                    try
                    {
                        list = serializer.DeSerialize<XActionList>();
                    }
                    catch
                    {
                        list = new XActionList();
                    }
                }
                return list; 
            } 
        }

        public void Save()
        {
            try
            {
                serializer.Serialize<XActionList>(list);
            }
            catch { }
        }
    }
}
